﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media;
using SMARTMobile.WinPhone.Models;
using SMARTMobile.WinPhone;
using System.ComponentModel;
using SMARTMobile.Annotations;
using System.Runtime.CompilerServices;

namespace SMARTMobile.Models.UI
{
    public class Category : NotificationObject
    {
        private string _name;
        private bool _isCategorySelected;
        private ImageSource _icon;

        public Category()
        {
            SubCategories = new ObservableCollection<Category>();
        }


        public string Name
        {
            get { return _name; }
            set
            {
                _name = value;
                OnPropertyChanged();
            }
        }

        public bool IsCategorySelected
        {
            get { return _isCategorySelected; }
            set
            {
                _isCategorySelected = value;
                OnPropertyChanged();
            }
        }

        public ImageSource Icon
        {
            get { return _icon; }
            set
            {
                _icon = value;
                OnPropertyChanged();
            }
        }

        public ICommandRoute PrivateCommand { get; set; }

        public ObservableCollection<Category> SubCategories
        {
            get;
            set;
        }
    }

    public class NotificationObject : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;

        [NotifyPropertyChangedInvocator]
        protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
        {
            var handler = PropertyChanged;
            if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
        }
    }

}
